

*********************************************************		
* Replication file for Tables in Paper and Appendix: HHD level regressions
* Kosec, Katrina and Olga Shemyakina. 2022. “Child Health and Land Reform in Kyrgyzstan*
* Economic Development and Cultural Change 2022 *
	* Katrina Kosec, International Food Policy Research Institute, k.kosec@cgiar.org
	* Olga Shemyakina, School of Economics, Georgia Institute of Technology, olga.shemyakina@econ.gatech.edu
*********************************************************		

* Programs might need to install
	*ssc install estout  

* Programs to find and then install
	*findit outreg2
	

	
*data file*		
		use "$root\EDCC_household.dta", clear

		
		iis oblast_int
				

		global head_c head_age head_male head_married head_kyrgyz head_uzbek head_russian
		
	
		
		**************************************************************************************************************
		//TABLE 3 - summary stats by hhd level: run and use results window output to manually create a table with means
		**************************************************************************************************************
				
		//all
		sum dexp1_food30d dhome_prod dtot1_food dexp_n_food30d dtot1_all sh_homefood sh_food below_med belme ///
		d_wage d_self d_aginc d_earn ///
		ref_m_all dmhasland hectland  hhsize head_male head_married head_age head_kyrgyz head_russian  head_uzbek head_other if dm_urban==0, sep(0)
		
		//by year
		bysort year: sum dexp1_food30d dhome_prod dtot1_food dexp_n_food30d dtot1_all sh_homefood sh_food below_med belme ///
		d_wage d_self d_aginc d_earn ///
		ref_m_all dmhasland hectland  hhsize head_male head_married head_age head_kyrgyz head_russian  head_uzbek head_other if dm_urban==0, sep(0)
		
		//labels
		d dexp1_food30d dhome_prod dtot1_food dexp_n_food30d dtot1_all sh_homefood sh_food below_med belme ///
		d_wage d_self d_aginc d_earn ///
		ref_m_all dmhasland hectland  hhsize head_male head_married head_age head_kyrgyz head_russian  head_uzbek head_other 
		
		
		estpost tabstat dexp1_food30d dhome_prod dtot1_food dexp_n_food30d ///
		dtot1_all sh_homefood sh_food below_med belme ///
		d_wage d_self d_aginc d_earn ///
		ref_m_all dmhasland hectland  hhsize head_male head_married ///
		head_age head_kyrgyz head_russian  ///
		head_uzbek head_other if dm_urban==0, by(year)  s(count mean) col(stat)
		
		esttab . using "$out_folder\Table3_paper.csv", cells("count(label(Obs.) fmt(0)) Mean(label(Mean) fmt(2)) ") ///
		title("Summary Statistics- Table 3")  nomtitle nonumber noobs replace
		
		*TABLE 7 - HH EXPENDITURE - ROBUST STANDARD ERRORS
		
			
		************formatted table output****
		//1.
		quietly  reg dmhasland  ref_m_all hhsize $head_c surv96 surv97 surv98 i.oblast_int if dm_urban==0, robust
		estimates store m21, title(has land)
		outreg2 using "$out_folder\Table7_paper.xls", replace dec(3) cttop(dmhasland)
		
		//2.  hectland
		quietly  reg  hectland ref_m_all hhsize $head_c  surv96 surv97 surv98 i.oblast_int if dm_urban==0, robust
		estimates store m22, title(Hectares of land hh has access to)
		outreg2 using "$out_folder\Table7_paper.xls", dec(3) cttop(hectland)
		
		******************************* HH , oblast dummies  ******************************************************
		//1. food puchased
		quietly  reg dexp1_food30d ref_m_all hhsize $head_c  surv96 surv97 surv98 i.oblast_ if dm_urban==0, robust
		estimates store m23, title(Food purchases)
		outreg2 using "$out_folder\Table7_paper.xls", dec(3) cttop(dexp1_food30d)
	
		
		//2. home produced food
		quietly  reg dhome_prod ref_m_all hhsize $head_c  surv96 surv97 surv98 i.oblast_ if dm_urban==0,  robust
		estimates store m24, title(Food home produced & consumed)
		outreg2 using "$out_folder\Table7_paper.xls", dec(3) cttop(dhome_prod)
		
		//3. dtot1_food
		quietly  reg dtot1_food ref_m_all hhsize $head_c  surv96 surv97 surv98 i.oblast_ if dm_urban==0, robust
		estimates store m25, title(Total food expenditures)
		outreg2 using "$out_folder\Table7_paper.xls", dec(3) cttop(dtot1_food)
		
		//4. non-food expenditure - dexp_n_food30d
		quietly  reg dexp_n_food30d ref_m_all hhsize $head_c  surv96 surv97 surv98 i.oblast_ if dm_urban==0, robust
		estimates store m26, title(Nonfood expenditures)
		outreg2 using "$out_folder\Table7_paper.xls", dec(3) cttop(dexp_n_food30d)
		
		//5. total expenditure
		quietly  reg dtot1_all ref_m_all hhsize $head_c  surv96 surv97 surv98 i.oblast_ if dm_urban==0, robust
		estimates store m27, title(Total expenditure)
		outreg2 using "$out_folder\Table7_paper.xls", dec(3) cttop(dtot1_all)
		
	
		
		*TABLE 8
				
		global head_c head_age head_male head_married head_kyrgyz head_uzbek head_russian
		
		//1. inc_earned: all components of earned income
		reg d_wage ref_m_all hhsize $head_c  surv97 surv98 i.oblast_ if dm_urban==0 & no96==1, cluster(HID) robust
		estimates store m21, title(wages)
		outreg2 using "$out_folder\Table8_income.xls", replace  dec(3) cttop("ei: wage")
		
		reg d_self ref_m_all hhsize $head_c  surv97 surv98 i.oblast_ if dm_urban==0 & no96==1, cluster(HID) robust
		estimates store m22, title(self-employment)
		outreg2 using "$out_folder\Table8_income.xls",   dec(3) cttop("ei: self")
		
		reg d_aginc ref_m_all hhsize $head_c  surv97 surv98 i.oblast_ if dm_urban==0 & no96==1, cluster(HID) robust
		estimates store m23, title(agric. income)
		outreg2 using "$out_folder\Table8_income.xls",   dec(3) cttop("ei: aginc")
		
		reg d_earn ref_m_all hhsize $head_c  surv97 surv98 i.oblast_ if dm_urban==0 & no96==1, cluster(HID) robust
		estimates store m24, title(earned income=wages+self+aginc)
		outreg2 using "$out_folder\Table8_income.xls",   dec(3) cttop("earned income")
		

			
		*Table 9 - Expenditure - - land interacted with expend
			
		//1. has land
		quietly reg dmhasland  ref_m_all belme  below_med hhsize $head_c surv96 surv97 surv98 i.oblast_int if dm_urban==0, robust
		estimates store m21, title(has land)
		outreg2 using "$out_folder\Table9_paper.xls", dec(3) replace cttop(dtot1_all)
		*dmhasland
		
		//2.  hectland
		quietly reg  hectland ref_m_all belme  below_med hhsize $head_c  surv96 surv97 surv98 i.oblast_int if dm_urban==0, robust
		estimates store m22, title(Hectares of land hh has access to)
		outreg2 using "$out_folder\Table9_paper.xls", dec(3)
		
	
